package com.softtown.modules.workflow.dao;

import com.softtown.common.dao.BaseDao;
import com.softtown.modules.workflow.entity.SwfProcPhaseEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: Dingyayong
 * @Date: 2019/8/21 19:51
 * @Description:
 */
@Mapper
public interface SwfProcPhaseDao extends BaseDao<SwfProcPhaseEntity> {

    /**
     * 找出差旅报销单审批段第一个审批段
     *
     * @param compId     公司id
     * @param procInstId 流程实例id
     * @return SwfProcPhaseEntity
     * @author Dingyayong
     * @date 2019/11/12 17:24
     */
    SwfProcPhaseEntity getActHeadFristSort(@Param("compId") Long compId, @Param("procInstId") Long procInstId);

    /**
     * 找出差旅报销单审批段最后一个审批段
     *
     * @param compId     公司id
     * @param procInstId 流程实例id
     * @return SwfProcPhaseEntity
     * @author Dingyayong
     * @date 2019/11/12 17:24
     */
    SwfProcPhaseEntity getActHeadLast(@Param("compId") Long compId, @Param("procInstId") Long procInstId);

    /**
     * 找出差旅报销单审批段当前审批段定义
     * @param compId
     * @param phaseId
     * @param procInstId
     * @return com.softtown.modules.entity.SwfProcPhaseEntity
     * @Author fuming
     * @Date 2020/5/27 17:33
     */
    SwfProcPhaseEntity getActHeadByNow(@Param("compId") Long compId, @Param("phaseId") Long phaseId, @Param("procInstId") Long procInstId);

    /**
     * 找出差旅报销单审批段当前审批段定义的下个审批段定义
     *
     * @param compId     公司id
     * @param procInstId 实例id
     * @param sortNum    序号
     * @return SwfProcPhaseEntity
     * @author Dingyayong
     * @date 2019/11/12 17:24
     */
    SwfProcPhaseEntity getActHeadNextBySort(@Param("compId") Long compId, @Param("procInstId") Long procInstId, @Param("sortNum") Integer sortNum);

    /**
     * 找出当前单据已有的流程审批段（按照sort_num排序）
     *
     * @param compId     公司id
     * @param procInstId 实例id
     * @return SwfProcPhaseEntity
     * @author Dingyayong
     * @date 2019/11/12 17:24
     */
    List<SwfProcPhaseEntity> getSwfProcPhaseListBySort(@Param("compId") Long compId, @Param("procInstId") Long procInstId);

    /**
     * 找出流程审批段按照id
     * @param phaseId id
     * @return SwfProcPhaseEntity
     * @author Dingyayong
     * @date 2019/11/12 17:24
     */
    List<SwfProcPhaseEntity> getSwfProcPhaseByPhaseIdList( Long phaseId);
}
